package com.listeningframework.boot.autoconfigure.mail.domains;

import java.util.List;
import java.util.Map;

import javax.activation.DataSource;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

/**
 * 
 * Mail Message
 *
 * @author lixining
 * @version $Id: MailMessage.java, v 0.1 2015年11月4日 上午11:45:20 lixining Exp $
 */
public class ListeningMailMessage {
    /**
     * Send To list
     */
    private List<String>            sendTo;
    /**
     * 抄送
     */
    private List<String>            sendCc;
    /**
     * Mail Subject
     */
    private String                  title;
    /**
     * Mail Content
     */
    private String                  message;
    /**
     * Send From
     */
    private String                  sendFrom;
    /**
     * 附件列表
     */
    private Map<String, DataSource> attachmentMap;

    public List<String> getSendTo() {
        return sendTo;
    }

    public void setSendTo(List<String> sendTo) {
        this.sendTo = sendTo;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getSendFrom() {
        return sendFrom;
    }

    public void setSendFrom(String sendFrom) {
        this.sendFrom = sendFrom;
    }

    public Map<String, DataSource> getAttachmentMap() {
        return attachmentMap;
    }

    public void setAttachmentMap(Map<String, DataSource> attachmentMap) {
        this.attachmentMap = attachmentMap;
    }

    public List<String> getSendCc() {
        return sendCc;
    }

    public void setSendCc(List<String> sendCc) {
        this.sendCc = sendCc;
    }

    public void addAttachment(String name, DataSource dataSource) {
        if (attachmentMap == null) {
            attachmentMap = Maps.newHashMap();
        }
        attachmentMap.put(name, dataSource);
    }

    public void addSendTo(String to) {
        if (sendTo == null) {
            sendTo = Lists.newArrayList();
        }
        sendTo.add(to);
    }

    public void addBatchSendTo(List<String> toList) {
        if (sendTo == null) {
            sendTo = Lists.newArrayList();
        }
        sendTo.addAll(toList);
    }
}
